<?php require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
require_once($_SERVER['DOCUMENT_ROOT']."/Modules/MGK20XF5/moduleconf.php");
MYDCONN();
$MYT = $GLOBALS["MYD"];
if (isset($_GET['DOCX']) || isset($_POST['DOCX'])) {
	if (isset($_GET['DOCX'])) {
	$DOCX = $_GET['DOCX'];
	} else {
	$DOCX = $_POST['DOCX'];
	}
	$GET = $GLOBALS['MYD']->db_array("SELECT 
			*		
		FROM doccenter_document 
		LEFT OUTER JOIN main_users ON main_users.ref = Author
		WHERE doccenter_document.Ref = {$DOCX}");

} else {

		$CLVARS = $GLOBALS['MYD']->db_array("DESCRIBE doccenter_document");
		for ($v = 1; $v <= $CLVARS[0]; $v++) {
			$CLVAR = $CLVARS[$v]['Field'];
			$GET[1][$CLVAR] = '';
		}
		$GET[1]['Ref'] = 0;
		$GET[1]['Author'] = '';
		$GET[1]['Attrib'] = 1;
}
echo '<div class="title">Propriedades do Documento </div>
<div id="doccenter_action">';
form_pr('DocEdit','','Modules/MGK20XF5/lib/pr_savedocument.php" target="doc_upload','post" enctype="multipart/form-data');
	mn_field('hidden','ED','Ref',$GET[1]['Ref'],'','','','');
	mn_field('hidden','ED','selected',0,'','','','');
?>
<table width="100%"  border="0" cellspacing="4" cellpadding="3">
      <tr bgcolor="#F2F2F2">
        <td>Tipo: <?php
		mn_field('select','ED','TYPE',$GET[1]['TYPE'],"SELECT REF AS ID, NAME FROM hcdc_types",'','','','');?>
	Departamento: <?php mn_field('select','ED','ddocArea',$GET[1]['ddocArea'],"SELECT ref AS ID, NAME FROM main_offices where office_number = 800 OR ref_domain = 0",'','','','');?>
	</td>
        <td><?php
		mn_field('file','ED','File','','80','40','','');
        mn_field('submit','ED','Enviar','Enviar','80','40','','" onclick="replaceUrl(\'list_files\',\''.$MODURL.'lib/list_showfiles.php?Ref='.$GET[1]['Ref'].'\');
			submit();');?><br/>
		Ficheiros<br/>
		<iframe name="doc_upload" id="doc_upload" style="overflow:scroll;width:0%;height:0;"></iframe>
	<div id="list_files"><?php include($MODPAD.'lib/list_showfiles.php'); ?></div>
        </td>
      </tr>
      <tr bgcolor="#F2F2F2">
        <td colspan="2">Título:<br/>
		<?php echo mn_field('text','ED','Title',str_replace('"','',$GET[1]['Title']),'','125','255','','" style="width:100%');?></td>
      </tr>
      <tr bgcolor="#F2F2F2">
        <td colspan="2">Texto:<br>
		<?php echo mn_field('textarea','ED','Body',$GET[1]['Body'],'96','20','','" style="width:100%');?></td>
      </tr>
      <tr bgcolor="#F2F2F2">
        <td><?php
		mn_field('button','ED','Save','Guardar Documento','','','','" onclick=" subform(\'DocEdit\',\'doccenter_action\');'); ?></td>
        <td>Estado:<?php mn_field('select','ED','STATUS',$GET[1]['STATUS'],"SELECT StatRef AS ID, name AS NAME FROM htck_status WHERE TYPE = 5",'','','');?>
		Responsável: <?php mn_field('select','ED','Attrib',$GET[1]['Attrib'],"SELECT sug_ID AS ID, sug_Name AS NAME FROM sys_usergroups",'','','','');?>
		Autor: <?php mn_field('textarea','ED','Author',$GET[1]['Author'],'24','1','','');?></td>
      </tr>
</table>
</form></div>